package com.guogee.pdb.dao;

public class DAOFactory {
    public enum DAOType{
    	Agency,
    	Community,
    	CommunityAccendant,
    	RLGatewayAgency,
    	Users,
    	UserThirdConfig,
    	Family,
    	Services,
    	FamilyMembers,
    	FamilyDevices,
    	RLGatewayDevice,
     	SmartLock,
    	UnlockedRecord,
    	AlarmRecord,
    	AlarmProcess,
    	TroubleTicket,
    	Evaluation,
    	LockAuthRecord,
    	Event,
    	AuthCode,
    	UserLoginRecord,
    	FamilyDevicesHistory,
    	Doorbell,
    }
    
    @SuppressWarnings("unchecked")
	public static <T> ADao<T> getDAO(DAOType type){
    	switch(type){
    	case Agency:
    		return (ADao<T>) new AgencyDAO();
    	case Community:
    		return (ADao<T>) new CommunityDAO(); 
    	case CommunityAccendant:
    		return (ADao<T>) new CommunityAccendantDAO();
    	case Users:
    		return (ADao<T>) new UserDAO();
     	case UserThirdConfig:
     		return (ADao<T>) new UserThirdConfigDAO(); 
    	case Family:
    		return (ADao<T>) new FamilyDAO();
       	case Services:
    		return (ADao<T>) new ServiceDAO();
    	case FamilyMembers:
    		return (ADao<T>) new FamilyMemberDAO();
    	case FamilyDevices:
    		return (ADao<T>) new FamilyDeviceDAO();
    	case RLGatewayDevice:
    		return (ADao<T>) new RLGatewayDeviceDAO();
      	case SmartLock:
    		return (ADao<T>)new SmartLockDAO();
    	case UnlockedRecord:
    		return (ADao<T>) new UnlockedRecordDAO(); 
    	case AlarmRecord:
    		return (ADao<T>) new AlarmRecordDAO(); 
    	case AlarmProcess:
    		return (ADao<T>) new AlarmProcessDAO(); 
    	case TroubleTicket:
    		return (ADao<T>) new TroubleTicketDAO();  
    	case Evaluation:
    		return (ADao<T>) new EvaluationDAO();  
    	case LockAuthRecord:
    		return (ADao<T>) new LockAuthRecordDAO(); 
    	case Event:
    		return (ADao<T>) new EventDAO();   
    	case AuthCode:
    		return (ADao<T>) new AuthCodeDAO();
    	case UserLoginRecord:
    		return (ADao<T>) new UserLoginRecordDAO();
     	case FamilyDevicesHistory:
    		return (ADao<T>) new FamilyDeviceHistoryDAO();
     	case Doorbell:
     		return (ADao<T>) new DoorbellInfoDAO();
    
    	}
    	return null;
    }
    
    
}
